Skip to content

Add Nerdbank.GitVersioning for git-derived version numbers#24

Merged
StuartMeeks merged 1 commit into
masterfrom
feat/nbgv
May 30, 2026
Merged

Add Nerdbank.GitVersioning for git-derived version numbers#24
StuartMeeks merged 1 commit into
masterfrom
feat/nbgv

Conversation

@StuartMeeks

Copy link
Copy Markdown
Owner

What

Implements the Nerdbank.GitVersioning (NBGV) carried-over item. The version string now maintains itself from git instead of falling back to the assembly's 1.0.0 compile-time default — so the About page shows a real version for dev and CI builds, and releases derive their number from NBGV rather than the hand-typed tag.

How it works

  • version.json (repo root) is the single source of truth: base 0.1.0-alpha.{height}, where {height} is the git commit height. versionHeightOffset: 1 starts the counter at alpha.2, past the previously hand-tagged v0.1.0-alpha.1, so there's no tag collision.
  • NBGV is referenced centrally (Directory.Packages.props + a PrivateAssets="all" reference in Directory.Build.props) so every assembly is stamped. Verified the Core assembly now carries AssemblyInformationalVersion = 0.1.0-alpha.2+<commit> — which is exactly what SettingsViewModel reads for the About page.
  • release.yml now installs nbgv, derives the version from nbgv get-version (asserting PublicRelease per publicReleaseRefSpec), and drops the redundant -p:Version on publish (NBGV stamps it). On a tagged public build, SemVer2 is the clean 0.1.0-alpha.N fed to Velopack.

Release ritual change (documented in CONTRIBUTING.md)

The tag trigger is unchanged, but you now mint the tag with NBGV so its name matches the computed version:

nbgv tag                       # e.g. v0.1.0-alpha.7
git push origin v0.1.0-alpha.7

You no longer hand-pick the -alpha.N counter — it tracks git height. For a stable cut, edit version.json (e.g. 0.1.0-alpha.{height}0.1.0), commit, then nbgv tag.

Verification

  • nbgv get-version post-commit → 0.1.0-alpha.2+f80913fbe3; Core assembly stamped accordingly (checked the generated AssemblyInfo/ThisAssembly).
  • WinUI head compiles clean on the Windows build agent — 0 warnings, 0 errors — including the no-.git case (NBGV degrades gracefully; TreatWarningsAsErrors not tripped).
  • ci.yml already checks out with fetch-depth: 0, so CI computes height correctly.

🤖 Generated with Claude Code

version.json (0.1.0-alpha.{height}) becomes the single source of truth for
the version. NBGV stamps every assembly at build time from version.json +
git height + commit hash, so the About page shows a real version for dev
and CI builds instead of the 1.0.0 compile-time fallback.

release.yml now derives the published version from `nbgv get-version`
(asserting a public release per publicReleaseRefSpec) instead of parsing the
tag string, and drops the redundant -p:Version on publish. versionHeightOffset
starts the alpha counter past the previously hand-tagged v0.1.0-alpha.1.
CONTRIBUTING documents the new `nbgv tag` release flow.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@StuartMeeks StuartMeeks merged commit dc92263 into master May 30, 2026
4 checks passed
@StuartMeeks StuartMeeks deleted the feat/nbgv branch May 30, 2026 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant